// =================================================================================================
//
//	CopyEngine Framework
//	Copyright 2012 Eran. All Rights Reserved.
//
//	This program is free software. You can redistribute and/or modify it
//	in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================

package gui.viewport
{
    import data.vo.LayoutItemVo;

    import flash.display.Sprite;
    import flash.text.TextField;

    public class LayoutItemBox extends Sprite
    {
        private var mItemVo:LayoutItemVo;

        private var mItemIDTF:TextField;

        public function LayoutItemBox()
        {
            mItemIDTF = new TextField();
            this.addChild(mItemIDTF);
            super();
        }

        public function refresh(_vo:LayoutItemVo):void
        {
            mItemVo = _vo;

            this.graphics.clear();
            this.graphics.beginFill(0xFFFF00, 1);
            this.graphics.lineStyle(3);
            this.graphics.drawRect(0, 0, mItemVo.itemWidth, mItemVo.itemHeight);
            this.graphics.endFill();

            mItemIDTF.text = mItemVo.itemID;
            mItemIDTF.x = (mItemVo.itemWidth - mItemIDTF.width) / 2;
            mItemIDTF.y = (mItemVo.itemHeight - mItemIDTF.height) / 2;
        }

        public function get itemVo():LayoutItemVo {return mItemVo;}


    }
}
